module Npc (
    input [31:0] pc,
    input [31:0] a,
    input [31:0] b,
    input [1:0]  Jump,
    input [1:0]  Branch,
    input [31:0] instr,
    output reg         PcSrc,
    output reg  [31:0] result
);
    
    parameter   JUMP = 2'b01,JR_JUMP=2'b10, NOJUMP = 2'b00;                     // Jump


    parameter   BRANCHE = 2'b01,BRANCHN=2'b10, NOBRANCH = 2'b00;  
    always @(*) begin
        if((Branch==BRANCHE&&a==b)||(Branch==BRANCHN&&a!=b))
        begin
            PcSrc = 1'b1;
            result = pc + (instr[15:0]<<2);
        end
        else if (Jump==JUMP)
        begin
            result = {pc[31:28], {instr[25:0] << 2}}; 
            PcSrc = 1'b1;
        end
           
        else if(Jump==JR_JUMP)
        begin
            result = a;
            PcSrc = 1'b1;
        end
        else
        begin
           PcSrc=1'b0; 
        end
        
    end
endmodule //adder